<?php

namespace App\Repositories\Transformers;

use App\Models\Video;
use League\Fractal\TransformerAbstract;

class VideoTransformer extends TransformerAbstract
{
    public function transform(Video $video)
    {
        return [
            'id' => $video->id,
            'title' => $video->title,
            'url' => $video->url,
            'desc' => $video->desc,
            'type' => $video->type,
            'content' => $video->content,
            'duration' => $video->duration,
            'cover' => $video->cover,
            'created_at' => $video->created_at != null ? $video->created_at->toDateTimeString() : null,
        ];
    }
}
